﻿using System;
using System.Xml.Serialization;

namespace FlickrSL.Data
{
    public enum Permissions
    {
        Nobody = 0,
        FriendsAndFamily = 1,
        Contacts = 2,
        Everybody = 3
    }

    [XmlType("permissions")]
    public class PhotoPermissions
    {
        [XmlIgnore]
        public Permissions CommentPermission { get; set; }

        [XmlAttribute("permcomment")]
        public String CommentPermissionString
        {
            get
            {
                return this.CommentPermission.ToString().ToLower();
            }

            set
            {
                this.CommentPermission = (Permissions)Enum.Parse(typeof(Permissions), value, true);
            }
        }

        [XmlIgnore]
        public Permissions AddMetadataPermission { get; set; }

        [XmlAttribute("permaddmeta")]
        public String AddMetadataPermissionString
        {
            get
            {
                return this.AddMetadataPermission.ToString().ToLower();
            }

            set
            {
                this.AddMetadataPermission = (Permissions)Enum.Parse(typeof(Permissions), value, true);
            }
        }
    }
}
